#pragma once
#include <nice2d/widgets/boxlayout.h>
#include <nice2d/widgets/titlebar.h>

class PanelStyle : public LayoutStyle
{
    DECLARE_OBJECT(PanelStyle)
public:
    PanelStyle();
    ~PanelStyle();
public:;
    PTree serialize()override;
    void deserialize(const PTree &node)override;
    void sync()override;

    std::shared_ptr<TitleBarStyle> titleBarStyle;
    std::shared_ptr<ControlStyle> contentStyle;
};

class Panel : public VBoxLayout
{
    DECLARE_OBJECT(Panel)
    Panel();
public:
    static std::shared_ptr<Panel> create(const sf::String& title,ControlPointer content);
    virtual ~Panel();
public:
    void setTitle(const sf::String& title);
    sf::String getTitle()const;
protected:
    virtual void adjust()override;
    virtual void onStyleChanged()override;
private:
    std::unique_ptr<class PanelData> data;
};
